<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="Users.aspx.cs" Inherits="Users" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phMain" Runat="Server">
    <asp:Panel ID="pnlSearch" runat="server">
        <acms:Columns ID="colsearch" runat="server">
            <acms:SingleColumn runat="server">
                <asp:Label CssClass="formLabel" Text="UserName" runat="server" />
            </acms:SingleColumn>
        </acms:Columns>
    </asp:Panel>
    <asp:GridView ID="gvUsers" SelectedIndex="0" runat="server" AllowPaging="True" PageSize="15" AutoGenerateColumns="False" DataSourceID="dsUsers" DataKeyNames="Id,ConcurencyId" OnSelectedIndexChanged="gvUsers_SelectedIndexChanged">
        <Columns>
            <acms:IndexField />
            <asp:BoundField DataField="UserName" HeaderText="User Name"/>
            <asp:BoundField DataField="DisplayName" HeaderText="Name"/>
            <asp:BoundField DataField="EmailAddress" HeaderText="Email"/>
            <asp:BoundField DataField="MobileTel" HeaderText="Mobile"/>
            <asp:BoundField DataField="DateOfBirth" HeaderText="Date of Birth" DataFormatString="{0:dd/MM/yyyy}"/>
            <asp:BoundField DataField="Gender" HeaderText="Gender"/>
            <asp:BoundField DataField="Created" HeaderText="Registered"
                SortExpression="Created" />
            <acms:CommandField ButtonType="Link" CausesValidation="False" EditVisible="False" HeaderText="" ReadOnlyVisible="True" SelectedVisible="True" CommandName="Select" Text="Select"/>
            <acms:CommandField ButtonType="Link" CausesValidation="False" EditVisible="False" HeaderText="" ReadOnlyVisible="True" SelectedVisible="True" ConfirmMessage="Are you sure you want to delete '{0}'?" ConfirmMessageDataFields="DisplayName" Text="Delete"/>
        </Columns>
        <PagerSettings Mode="NumericFirstLast" />
    </asp:GridView>
    <asp:Panel ID="pnlDetails" Visible="false" runat="server">
        <h2><asp:Label ID="lblUserName" runat="server" /></h2>
    <telerik:RadTabStrip ID="tabUser" AutoPostBack="true" runat="server" MultiPageID="mpUser" SelectedIndex="0" OnTabClick="tabUser_TabClick">
        <Tabs>
            <telerik:RadTab runat="server" PageViewID="pvUserDetails" Text="Details">
            </telerik:RadTab>
            <telerik:RadTab runat="server" PageViewID="pvUserRoles" Text="Roles">
            </telerik:RadTab>
        </Tabs>
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="mpUser" runat="server" SelectedIndex="0">
        <telerik:RadPageView ID="pvUserDetails" runat="server">
            <asp:DetailsView ID="dvUserDetails" DefaultMode="ReadOnly" DataKeyNames="Id,ConcurencyId" DataSourceID="dsUsers" runat="server">
                <Fields>
                </Fields>
            </asp:DetailsView>
        </telerik:RadPageView>
        <telerik:RadPageView ID="pvUserRoles" runat="server">
            <asp:GridView ID="gvUserRoles" DataSourceID="dsUserRoles" runat="server" AutoGenerateColumns="False">
                <Columns>
                    <asp:BoundField DataField="RoleName" ReadOnly="true" HeaderText="RoleName" SortExpression="RoleName" />
                    <acms:DateTimeField DataField="Start" HeaderText="Start" SortExpression="Start" />
                    <acms:DateTimeField DataField="End" HeaderText="End" SortExpression="End" />
                    <acms:CommandField ButtonType="Link" EditVisible="False" CommandName="Edit" Text="Edit" />
                    <acms:CommandField ButtonType="Link" EditVisible="False" CommandName="Delete" Text="Remove" ConfirmMessage="Are you sure you want to remove this role?"/>
                    <acms:CommandField ButtonType="Link" CausesValidation="True" EditVisible="True" ReadOnlyVisible="False" SelectedVisible="False" CommandName="Update" Text="Save"/>
                    <acms:CommandField ButtonType="Link" CausesValidation="True" EditVisible="True" ReadOnlyVisible="False" SelectedVisible="False" CommandName="Cancel" Text="Cancel"/>
                </Columns>
            </asp:GridView>
            &nbsp;
            <asp:Wizard ID="wizAddUserRole" runat="server" Visible="false" ActiveStepIndex="0" DisplaySideBar="false">
                <WizardSteps>
                    <asp:WizardStep runat="server" StepType="Start" Title="Select Role" AllowReturn="true">
                        <acms:AcmsDataList ID="dlRoleAddRole" DataSourceID="dsRoles" runat="server">
                            <SelectedItemTemplate>
                                <div style="float:left;padding:10px;border:solid 1px gray;margin:5px;background-color:Yellow;width:33%;">
                                    <h3><%#Eval("Name") %></h3>
                                    <p>
                                        <%#Eval("Description") %>
                                    </p>
                                </div>
                            </SelectedItemTemplate>
                            <ItemTemplate>
                                <asp:Panel id="pnlRole" DefaultButton="btnSelect" style="float:left;padding:10px;border:solid 1px gray;margin:5px;width:33%;" runat="server">
                                    <h3><%#Eval("Name") %></h3>
                                    <p>
                                        <%#Eval("Description") %>
                                    </p>
                                    <p>
                                        <asp:LinkButton ID="btnSelect" runat="server" Text="Select" CommandName="Select" />
                                    </p>
                                </asp:Panel>
                            </ItemTemplate>
                        </acms:AcmsDataList>
                    </asp:WizardStep>
                    <asp:WizardStep runat="server" StepType="Finish" Title="Set Dates"  AllowReturn="true">
                        <asp:Label ID="lblStartDate" Text="Start Date" AssociatedControlID="txtStartDate" runat="server"/><br />
                        <telerik:RadDateTimePicker ID="txtStartDate" runat="server">
                        </telerik:RadDateTimePicker><br />
                        <asp:Label ID="lblEndDate" runat="server" Text="End Date" AssociatedControlID="txtEndDate"></asp:Label><br/>
                        <telerik:RadDateTimePicker ID="txtEndDate" runat="server" Culture="English (United Kingdom)">
                            <TimeView Culture="English (United Kingdom)" Skin="" style="display:none;" runat="server"></TimeView>
                            <DateInput Skin="" runat="server"></DateInput>
                        </telerik:RadDateTimePicker>
                    </asp:WizardStep>
                </WizardSteps>
            </asp:Wizard>
        </telerik:RadPageView>
    </telerik:RadMultiPage>
    </asp:Panel>
    <acms:UserDataSource ID="dsUsers" runat="server" EnablePaging="False"
        OnSelectData="dsUsers_SelectData">
    </acms:UserDataSource>
    <acms:UserRolesDataSource Id="dsUserRoles" runat="server" OnSelectData="dsUserRoles_SelectData" />
    <acms:RolesDataSource ID="dsRoles" runat="server" OnSelectData="dsRoles_SelectData" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phActions" Runat="Server">
    <asp:LinkButton ID="lnkSelectUser" Text="List Users" Visible="false" runat="server" OnClick="lnkSelectUser_Click" />
    <asp:LinkButton ID="lnkEdit" Text="Edit" Visible="false" runat="server" OnClick="lnkEdit_Click"/>
    <asp:LinkButton ID="lnkSave" Text="Save" Visible="false" runat="server" OnClick="lnkSave_Click"/>
    <asp:LinkButton ID="lnkCancel" Text="Cancel" Visible="false" runat="server" OnClick="lnkCancel_Click"/>
    <asp:LinkButton ID="lnkAddRole" Text="Add Role" Visible="false" runat="server" OnClick="lnkAddRole_Click"/>
</asp:Content>

